/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package SynchronizationLayer;

import java.util.Collection;

/**
 *
 * @author Tomasz Nowak
 */
public class ConversationGroup
{
	private NotarySynchronizationMessageType[] messageTypes;
	private Collection<Conversation> conversations;
	private IConversationResolver conversationResolver;

	public ConversationGroup( NotarySynchronizationMessageType[] messageTypes, IConversationResolver conversationResolver )
	{
		this.messageTypes = messageTypes;
	}

	public NotarySynchronizationMessageType[] getMessageTypes()
	{
		return messageTypes;
	}

	public void setMessageTypes( NotarySynchronizationMessageType[] messageTypes )
	{
		this.messageTypes = messageTypes;
	}

	public Conversation getConversation( NotarySynchronizationPacket notarySynchronizationPacket )
	{
		Conversation conversation = conversationResolver.resolve(conversations, notarySynchronizationPacket);
		conversation.setConversationGroup(this);
		return conversation;
	}

	public void removeConversation( Conversation conversation )
	{
		conversations.remove(conversation);
	}
}
